package com.jxd.ordering.handle;

import com.jxd.ordering.exception.GlobalException;
import com.jxd.ordering.model.ResultBody;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @ClassName GloableExceptionHandler
 * @Description TODO
 * @Author Ankailong
 * @Date 2022/9/29
 * @Version 1.0
 */

@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(value = GlobalException.class)
    public ResultBody handelException(GlobalException e){
        return ResultBody.error(e.getErrorCode(),e.getErrorMsg());
    }
}
